import Vue from 'vue'
import Router from 'vue-router'
// import Login from '@pages/Login'
import Login from '@/pages/Login'
import Home from '@/pages/Home'
import Life from '@/pages/Life'
import Web from '@/pages/Web'
import Print from '@/pages/Print'
// 增强原方法，好处是旧的业务模块不需要任何变动 配合页面跳转动画
import Version from '@/pages/Version'
import Alert from '@/pages/Alert'
import Buttons from '@/pages/Buttons'
import Cards from '@/pages/Cards'
import DateTime from '@/pages/DateTime'
Router.prototype.go = function () {
  this.isBack = true
  window.history.go(-1)
}
Vue.use(Router)

export default new Router({
  routes: [
    // {
    //   path: '/',
    //   name: 'Login',
    //   component: Login
    // },

    {path: '/', redirect: 'home'},
    {
      path: '/home',
      name: 'Home',
      component: Home,
      children:[
        {
            path:'/version',
            component:Version,
        },
        {
          path: '/alert',
          component: Alert
        },
        {
          path: '/button',
          component: Buttons
        },
        {
          path: '/card',
          component: Cards
        },
        {
          path: '/dateTime',
          component: DateTime
        }
      ]
    }, {
      path: '/life',
      name: 'Life',
      component: Life
    }, {
      path: '/web',
      name: 'Web',
      component: Web
    }, {
      path: '/print',
      name: 'Print',
      component: Print
    }
  ]
})
